A buffer that will reside on the GPU. More...
Public Member Functions | |
Buffer () | |
Buffer (const Buffer &other)=delete | |
virtual | ~Buffer () |
unsigned int | getElementByteSize () const |
unsigned int | getElementCount () const |
unsigned int | getTotalByteSize () const |
virtual USAGE | getUsage () const =0 |
virtual BIND_FLAG | getBindFlag () const =0 |
virtual CPU_ACCESS_FLAG | getCpuAccessFlag () const =0 |
virtual RESOURCE_MISC_FLAG | getMiscFlag () const =0 |
void | setCpuData (const nkMemory::BufferView<> &data) |
void | setCpuDataCopy (const nkMemory::BufferView<> &data) |
void | setCpuDataForward (nkMemory::Buffer &&data) |
virtual void | freeCpuData () |
virtual void | setElementByteSize (unsigned int value) |
virtual void | setElementCount (unsigned int value) |
virtual void | setUsage (USAGE value)=0 |
virtual void | setBindFlag (BIND_FLAG value)=0 |
virtual void | setCpuAccessFlag (CPU_ACCESS_FLAG value)=0 |
virtual void | setMiscFlag (RESOURCE_MISC_FLAG value)=0 |
virtual void | copyParams (const Buffer &other)=0 |
virtual MapResult | map (const MapRequestDescriptor &requestDesc)=0 |
virtual void | unmap (const UnmapRequestDescriptor &requestDesc)=0 |
virtual void | gpuCopyFrom (Buffer &other, const ResourceGpuCopyDescriptor &descriptor)=0 |
virtual void | prepareForShaderResourceUsage (bool value=true) |
virtual void | prepareForComputeResourceUsage (bool value=true) |
virtual void | prepareForOutputStreamUsage (bool value=true) |
Buffer & | operator= (const Buffer &other)=delete |
virtual void | exportClassToTree (nkExport::Node *rootNode) override |
virtual void | importClassFromTree (nkExport::Node *rootNode) override |
![]() | |
ShaderResource () | |
~ShaderResource () | |
![]() | |
Resource () | |
Resource (const nkMemory::StringView &path) | |
virtual | ~Resource () |
bool | isReadyForRendering () const |
bool | isUnloaded () const |
RESOURCE_LOAD_STATE | getLoadState () const |
nkMemory::StringView | getResourcePath () const |
RESOURCE_TYPE | getResourceTypeName () const |
nkMemory::StringView | getResourceName () const |
bool | getHidden () const |
bool | getGpuUploadCanBeDeferred () const |
virtual void | setResourcePath (const nkMemory::StringView &path) |
void | setResourceName (const nkMemory::StringView &name) |
void | setHidden (bool value) |
void | setGpuUploadCanBeDeferred (bool value) |
virtual bool | load ()=0 |
virtual void | unload ()=0 |
![]() | |
Exportable () | |
virtual | ~Exportable () |
A buffer that will reside on the GPU.
Used as the basic memory holder to push data to the GPU. Each renderer will have its own implementation to adapt it to the API it targets.
nkGraphics::Buffer::Buffer | ( | ) |
Default Constructor.
|
delete |
Copy constructor.
|
virtual |
Destructor.
unsigned int nkGraphics::Buffer::getElementByteSize | ( | ) | const |
unsigned int nkGraphics::Buffer::getElementCount | ( | ) | const |
unsigned int nkGraphics::Buffer::getTotalByteSize | ( | ) | const |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
void nkGraphics::Buffer::setCpuData | ( | const nkMemory::BufferView<> & | data | ) |
Sets the CPU data to upload to the gpu buffer during load.
data | The data to provide. |
void nkGraphics::Buffer::setCpuDataCopy | ( | const nkMemory::BufferView<> & | data | ) |
Sets the CPU data to upload to the gpu buffer during load.
data | The data to provide. |
void nkGraphics::Buffer::setCpuDataForward | ( | nkMemory::Buffer && | data | ) |
Sets the CPU data to upload to the gpu buffer during load.
data | The data to provide. |
|
virtual |
Frees the CPU data holding structures and, if owning them, local shadow CPU buffers.
|
virtual |
Sets the size of an element within the buffer.
value | The byte size an element will have in the buffer. |
|
virtual |
Sets the number of elements inside the buffer.
value | The number of elements to declare inside the buffer. |
|
pure virtual |
Sets the usage flag in the buffer.
value | The usage flag to declare. |
|
pure virtual |
Sets the binding flags for the buffer.
value | The binding flag to declare. |
|
pure virtual |
Sets the cpu access flags for the buffer.
value | The value to declare. |
|
pure virtual |
Sets the misc flags for the buffer.
value | The value to declare. |
|
pure virtual |
Copies the parameters from another buffer.
other | The buffer to copy the parameters from. |
|
pure virtual |
Maps the buffer. This allows to read or write the GPU data from the cpu context. For a read request, depending on the usage and CPU access flag, this can trigger staging buffer creation and copy to pull data from the GPU. Note that in some cases, this means a flush in the GPU pipeline (and a CPU lock) to ensure the latest data is retrieved.
requestDesc | The description of what kind of mapping is needed. |
|
pure virtual |
Requests to unmap the buffer. Should be called the earliest possible after a call to map().
requestDesc | The description of the unmap request. |
|
pure virtual |
Copy memory from one buffer to another. This will trigger copies on GPU, and involve the CPU the least possible.
other | The buffer to copy from. |
descriptor | The description of what kind of copy is wanted. |
|
virtual |
Prepares the resource for an usage as a shader resource. This is needed to use the buffer in a Shader::addTexture() call.
value | If the buffer should be usable in such context (true) or not (false). |
|
virtual |
Prepares the resource for an usage as a compute resource. This is needed to use the buffer in a Shader::addUavBuffer() call.
value | If the buffer should be usable in such context (true) or not (false). |
|
virtual |
Prepares the resource for an usage as an output stream resource. This is needed to use the buffer in a Renderer::launchGeometryShaderStream() call.
value | If the buffer should be usable in such context (true) or not (false). |
|
overridevirtual |
Basic export capability.
rootNode | The root of the tree to export to. |
Implements nkExport::Exportable.
|
overridevirtual |
Basic import capability.
rootNode | The root of the tree to import from. |
Implements nkExport::Exportable.